

import { useParams } from "react-router-dom"
import { Form, Input, Button, Checkbox } from 'antd';
import {useState,useEffect} from "react"

export default function (props) {
    console.log(props,"props")
    const params = useParams();
    const [goods,setGoods] = useState({})
    const onFinish = (values) => {
        console.log('Success:', values);
        setGoods(values)
    };

    const onFinishFailed = (errorInfo) => {
        console.log('Failed:', errorInfo);
    };

    const getGoods = ()=>{
        console.log(goods)
    }

    useEffect(()=>{
        console.log("触发了")
    })

    console.log(params)
    return (
        <Form
            name="basic"
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 16 }}
            initialValues={{ remember: true }}
            onFinish={onFinish}
            onFinishFailed={onFinishFailed}
            autoComplete="off"
        >
            <Form.Item
                label="goodsName"
                name="goodsName"
                rules={[{ required: true, message: 'Please input your goodsName!' }]}
            >
                <Input />
            </Form.Item>

            <Form.Item
                label="Password"
                name="password"
                rules={[{ required: true, message: 'Please input your password!' }]}
            >
                <Input.Password />
            </Form.Item>

            <Form.Item name="remember" valuePropName="checked" wrapperCol={{ offset: 8, span: 16 }}>
                <Checkbox>Remember me</Checkbox>
            </Form.Item>

            <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
                <Button type="primary" htmlType="submit">
                    Submit
                </Button>
                <Button type="dangerous" onClick={getGoods.bind(this)}>get</Button>
            </Form.Item>
        </Form>
    )
}